/*
 * @Author: HeAo
 * @Date: 2022-08-10 19:31:42
 * @LastEditTime: 2022-08-11 19:06:49
 * @LastEditors: HeAo
 * @Description: 
 * @FilePath: \JavaScripe\day-03\08-检测属性.js
 * 别乱动！
 */
var obj = {
  name: 'zhansan',
  age: 19,
  gender: '男'
}

// 1、in 检测自身或继承属性
console.log('name' in obj); //true
console.log('toString' in obj); //true


// 2、hasOwnProperty 检测是否为自身属性，继承为false
var obj = {
  name: 'zhansan',
  age: 19,
  gender: '男'
}
console.log(obj.hasOwnProperty('name')); //true
console.log(obj.hasOwnProperty('toString')); //false

// 3、propertyIsEnumerable 检测是否为自身属性 并且 是否为我们创建（可枚举）
var obj = {
  name: 'zhansan',
  age: 19,
  gender: '男'
}
console.log(obj.propertyIsEnumerable('name')); //true
console.log(obj.propertyIsEnumerable('toString')); //false